//microcommand define specialtitle
ctx = ctx.platform("onebot")
signature("<user:user> <title:rawtext>", { checkUnknown: true, authority: 3 })
option("remove", "-r")
option("channel", "-g, -c, --guild, --group <channel:channel>", { authority: 3, descPath: "admin.channel-option" })
action(async ({ session, options }, user, title) => {
if (user == null) return session.i18n("internal.insufficient-arguments")
if (options.remove) title = ""
else if (title == null) return session.i18n("internal.insufficient-arguments")
if (session.isDirect && !options.channel) return session.i18n("admin.not-in-group")
const channelId = options.channel?.slice(options.channel.split(":", 1)[0].length + 1) ?? session.channelId
await session.onebot.setGroupSpecialTitle(channelId, user.slice(user.split(":", 1)[0].length + 1), title)
session.onebot._request("set_msg_emoji_like", { message_id: session.messageId, emoji_id: 124 }).catch(() => {})
})
locale("zh-CN", {
description: "设置群专属头衔",
usage: "bot 需为群主才可使用。",
options: {
remove: "移除头衔",
},
})